<!--  -->
<template>
  <div>
    <el-table :data="m_TableData" style="width: 100%">
      <el-table-column v-for="(col, i) in Columns" :key="i" :prop="col.prop" :label="col.label" :width="col.width ? col.width : null" :align="col.align ? col.align : null" :min-width="col.minwidth ? col.minwidth : null">
        <template slot-scope="scope">
          <div style="cursor: pointer" v-if="col.prop == 'action'">
            <el-button @click="TableEdit(scope.row)" type="text" size="small">编辑</el-button>
            <el-button @click="TableDel(scope.row)" type="text" size="small">删除</el-button>
          </div>
          <div v-else>
            {{ col.customRender ? col.customRender(scope, scope.row[col.prop]) : scope.row[col.prop] }}
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import dayjs from 'dayjs';
import Api from '../../../api/projectInfo';
export default {
  components: {},
  data() {
    return {
      m_QueryParams: { total: 0, currentPage: 1, pageSize: 10 },
      m_TableData: [],
    };
  },
  filters: {
    nullVal: function (msg) {
      return msg ? msg : '-';
    },
  },
  //监听属性 类似于data概念
  computed: {
    Columns() {
      let align = 'center';
      let width = null;
      let columns = [
        {
          label: '序号',
          prop: 'kjine',
          align: align,
          width: '100',
          customRender: function (scope, text) {
            return scope.$index + 1;
          },
        },
        {
          label: '处理人',
          prop: 'auditorsDesc',
          align: align,
          width: width,
          
        },
        {
          label: '处理时间',
          prop: 'approveTime',
          align: align,
          width: width,
          customRender: function (scope, text) {
            if (text) return dayjs(text).format('YYYY-MM-DD HH:mm');
          },
        },
        {
          label: '处理结果',
          prop: '',
          align: align,
          width: width,
          customRender: function (scope, text) {
            if (scope.row.opinionType == 1) return '审核通过';
            if (scope.row.opinionType == 4) return '审核驳回';
          },
        },
        {
          label: '意见说明',
          prop: 'approvalMessage',
          align: align,
          width: width,
    
        },
      ];
      return columns;
    },
  },
  //监控data中的数据变化
  watch: {
    // m_Data: {
    //   immediate: true,
    //   deep: true,
    //   handler(val) {},
    // },
  },
  //接收参数
  props: {
    //m_Data: {
    //type: String,
    //default: '',
    //},
  },
  //生命周期 - 创建完成（访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    this.businessgetMessage();
  },
  //方法集合
  methods: {
    businessgetMessage() {
      Api.businessgetMessage({ businessKey: this.$route.query.processWorkId }).then(res => {
        this.m_TableData = res.rows || [];
      });
    },
    TableEdit(row) {},
    TableDel(row) {},
  },
};
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>